﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    xmlns:c="clr-namespace:ShredTheLog.Controls;assembly=ShredTheLog.Controls"
    xmlns:tk="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
    >

    <DataTemplate DataType="{x:Type vm:ContactListViewModel}">
        <tk:DataGrid ItemsSource="{Binding Contacts}">
            <ItemsControl.ItemContainerStyle>
                <Style TargetType="{x:Type tk:DataGridRow}">
                    <Setter Property="ContextMenu">
                        <Setter.Value>
                            <ContextMenu c:Extensions.Items="{Binding Converter={x:Static vm:UserMenuItemsConverter.Default}}" DataContext="{Binding RelativeSource={RelativeSource Mode=Self}, Path=PlacementTarget.DataContext}"/>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="ToolTip" Value="{StaticResource UserToolTip}"/>
                </Style>
            </ItemsControl.ItemContainerStyle>
            <tk:DataGrid.Columns>
                <tk:DataGridTemplateColumn Header="{x:Null}" CanUserResize="False" SortMemberPath="Gender">
                    <tk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <ContentPresenter Content="{Binding Gender}" HorizontalAlignment="Center"/>
                        </DataTemplate>
                    </tk:DataGridTemplateColumn.CellTemplate>
                </tk:DataGridTemplateColumn>
                <tk:DataGridTextColumn Header="{c:LocalizedString s_Name}" Binding="{Binding Name}" Width="*"/>
                <tk:DataGridTextColumn Header="{c:LocalizedString s_Country}" Binding="{Binding Path=Country, Converter={x:Static cnv:CountryConverter.Default}}" c:Extensions.Comparer="{x:Static cnv:ShortUserInfoByCountryComparer.Default}" Width="*"/>
                <tk:DataGridTextColumn Header="{c:LocalizedString s_Age}" Binding="{Binding Age}">
                    <tk:DataGridTextColumn.ElementStyle>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="TextAlignment" Value="Right"/>
                        </Style>
                    </tk:DataGridTextColumn.ElementStyle>
                </tk:DataGridTextColumn>
            </tk:DataGrid.Columns>
        </tk:DataGrid>
    </DataTemplate>
</ResourceDictionary>